#ifndef _H_HTEA
#define _H_HTEA

#include "hplatform.h"

#ifdef __cplusplus
extern "C" {
#endif // #ifdef __cplusplus

#define TEA_UNITSIZE                    8

// encode a buffer, with built-in header
int HPLATFORMCALL htea_enc_buff(const char* buf, int in_size, unsigned int key[4], char* out_buf, int* out_size);

// decode a buffer, if buf is not encoded by htea_enc_buf, 1 will be returned
int HPLATFORMCALL htea_dec_buff(const char* buf, int in_size, unsigned int key[4], char* out_buf, int* out_size);

// encode a file
int HPLATFORMCALL htea_enc_file(const char* src_file, const char* dst_file, unsigned int key[4]);

// decode a file, if src_file is not encoded by htea_enc_file, 1 will be returned
int HPLATFORMCALL htea_dec_file(const char* src_file, const char* dst_file, unsigned int key[4]);

// encode a buffer, without header, the out buffer is naked
// encryption algorithm processing 8 bytes memory in one cycle, ragged part of original buffer will filled by zero.
int HPLATFORMCALL htea_enc_buff_naked(const char* buf, int in_size, unsigned int key[4], char* out_buf, int* out_size);

// decode a buffer, if buf is not encoded by htea_enc_buff_naked, 1 will be returned
int HPLATFORMCALL htea_dec_buff_naked(const char* buf, int in_size, unsigned int key[4], char* out_buf, int* out_size);

#ifdef __cplusplus
}
#endif // #ifdef __cplusplus

#endif // #ifndef _H_HTEA

